<!-- <!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    .box{
      width: 200px;
      height: 200px;
      background-color: red;
    }
  </style>
</head>
<body>
 移动端事件介绍 
<div class="box"></div>
<script>
  var box = document.querySelector('.box');
  box.onclick = function(){
    alert(1);
  }
  //推荐使用事件监听
  //touchstart
  //touchmove
  //touchend
  box.addEventListener('touchstart',function(){
    alert('该元素被点击了');//相当于点击事件click
  });
  //手指在屏幕(元素)按下去并且移动 相当于mousedown
  box.addEventListener('touchmove',function(){
    console.log('元素移动');
  });
  //手指离开屏幕(元素/标签)时候触发的事件 相当于mouseup
  box.addEventListener('touchend',function(){
    console.log('元素被点了');
  });
</script>
</body>
</html> -->
<!-- <!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    .box{
      width: 200px;
      height: 200px;
      background-color: pink;
    }
  </style>
</head>
<body>
  <div class="box"></div>
  <script>
    //比较touch事件 比 click事件要快300毫秒
    var box = document.querySelector('.box');
    box.addEventListener('click',function(){
      console.log('我是click事件');
    });
    box.addEventListener('touchstart',function(){
      console.log('我是touch事件');
    })
  </script>
</body>
</html> -->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>移动端事件对象参数信息介绍</title>
  <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    .box{
      width: 200px;
      height: 200px;
      background-color: red;
    }
  </style>
</head>
<body>
  <div class="box"></div>
  <script>
    var box = document.querySelector('.box');
    box.addEventListener('touchstart',function(e){
      //获取移动端事件对象
      console.log(e);
      console.log(e.targetTouches[length].clientX)
    })
  </script>
</body>
</html>